package com.cjf.androidstudy.component;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

import com.cjf.androidstudy.utils.FileUtils;

import java.io.IOException;

/**
 * author: cjf
 * date: 2021-07-13 23:37
 * description: 静态广播  - 实现监听开机广播
 */
public class BootCompletedReceiver extends BroadcastReceiver {
    private static final String TAG = "BootCompletedReceiver";

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.i(TAG, "onReceive: Boot completed.....");
        try {
            FileUtils.saveData(context, "bootData", "Boot completed.....");
        } catch (IOException e) {
            Log.e(TAG, "onClick: ", e);
        }
        Toast.makeText(context, "Boot completed", Toast.LENGTH_SHORT).show();
    }
}
